package xin.nick.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import xin.nick.api.LandOrderApi;

import javax.annotation.Resource;

@RestController
public class UserInfoController {

    @Autowired
    private RestTemplate restTemplate;

//    @Autowired
//    private LandOrderApi landOrderApi;

    @GetMapping("/getUserInfo")
    public String getUserInfo() {

        ResponseEntity<String> orderResponse = restTemplate.exchange("http://land-order-service/order/getOrderInfo", HttpMethod.GET, new HttpEntity(new HttpHeaders()), String.class);
        String orderInfo = orderResponse.getBody();

//        String orderInfo = landOrderApi.getOrderInfo();
        return "Hello,我买了:" +  orderInfo;
    }

}
